import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { OrderCustomerApi } from '#/api/spa/order/customer';

import { z } from '#/adapter/form';
import {
    DICT_TYPE,
    getDictOptions,
    getRangePickerDefaultProps,
} from '#/utils';

import {DICT_SPA_TYPE} from "#/utils/dictSpa";
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'id',
      component: 'Input',
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
      fieldName: 'orderId',
      label: '关联spa_order表ID',
      rules: 'required',
      component: 'Input',
      componentProps: {
        placeholder: '请输入关联spa_order表ID',
      },
    },
    {
      fieldName: 'orderExtensionId',
      label: '关联spa_order_extension表ID',
      rules: 'required',
      component: 'Input',
      componentProps: {
        placeholder: '请输入关联spa_order_extension表ID',
      },
    },
    {
      fieldName: 'customerId',
      label: '客户ID',
      rules: 'required',
      component: 'Input',
      componentProps: {
        placeholder: '请输入客户ID',
      },
    },
    {
      fieldName: 'customerType',
      label: '客户类型',
      component: 'Select',
      componentProps: {
        options: getDictOptions(DICT_SPA_TYPE.SPA_Settlement_Status, 'string'),
        placeholder: '请选择客户类型',
      },
    },
    {
      fieldName: 'customerName',
      label: '客户姓名',
      rules: 'required',
      component: 'Input',
      componentProps: {
        placeholder: '请输入客户姓名',
      },
    },
    {
      fieldName: 'customerPhone',
      label: '客户电话',
      component: 'Input',
      componentProps: {
        placeholder: '请输入客户电话',
      },
    },
    {
      fieldName: 'customerAge',
      label: '客户年龄',
      component: 'Input',
      componentProps: {
        placeholder: '请输入客户年龄',
      },
    },
    {
      fieldName: 'customerGender',
      label: '客户性别',
      component: 'Input',
      componentProps: {
        placeholder: '请输入客户性别',
      },
    },
    {
      fieldName: 'specialRequirements',
      label: '特殊要求',
      component: 'Input',
      componentProps: {
        placeholder: '请输入特殊要求',
      },
    },
    {
      fieldName: 'healthNotes',
      label: '健康备注',
      component: 'Input',
      componentProps: {
        placeholder: '请输入健康备注',
      },
    },
    {
      fieldName: 'allergies',
      label: '过敏信息JSON',
      component: 'Input',
      componentProps: {
        placeholder: '请输入过敏信息JSON',
      },
    },
    {
      fieldName: 'preferences',
      label: '偏好设置JSON',
      component: 'Input',
      componentProps: {
        placeholder: '请输入偏好设置JSON',
      },
    },
    {
      fieldName: 'scope',
      label: '权限范围',
      component: 'Input',
      componentProps: {
        placeholder: '请输入权限范围',
      },
    },
    {
      fieldName: 'scoperef',
      label: '权限引用',
      component: 'Input',
      componentProps: {
        placeholder: '请输入权限引用',
      },
    },
    {
      fieldName: 'customerRelationship',
      label: '与主客户关系',
      component: 'Input',
      componentProps: {
        placeholder: '请输入与主客户关系',
      },
    },
    {
      fieldName: 'emergencyContact',
      label: '紧急联系人',
      component: 'Input',
      componentProps: {
        placeholder: '请输入紧急联系人',
      },
    },
    {
      fieldName: 'emergencyPhone',
      label: '紧急联系电话',
      component: 'Input',
      componentProps: {
        placeholder: '请输入紧急联系电话',
      },
    },
    {
      fieldName: 'medicalHistory',
      label: '病史记录',
      component: 'Input',
      componentProps: {
        placeholder: '请输入病史记录',
      },
    },
    {
      fieldName: 'currentMedications',
      label: '当前用药情况',
      component: 'Input',
      componentProps: {
        placeholder: '请输入当前用药情况',
      },
    },
    {
      fieldName: 'dietaryRestrictions',
      label: '饮食限制',
      component: 'Input',
      componentProps: {
        placeholder: '请输入饮食限制',
      },
    },
    {
      fieldName: 'accessibilityNeeds',
      label: '无障碍需求',
      component: 'Input',
      componentProps: {
        placeholder: '请输入无障碍需求',
      },
    },
  ];
}

/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'orderId',
      label: '关联spa_order表ID',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入关联spa_order表ID',
      },
    },
    {
      fieldName: 'orderExtensionId',
      label: '关联spa_order_extension表ID',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入关联spa_order_extension表ID',
      },
    },
    {
      fieldName: 'customerId',
      label: '客户ID',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入客户ID',
      },
    },
    {
      fieldName: 'customerType',
      label: '客户类型',
      component: 'Select',
      componentProps: {
        allowClear: true,
        options: getDictOptions(DICT_SPA_TYPE.SPA_Settlement_Status, 'string'),
        placeholder: '请选择客户类型',
      },
    },
    {
      fieldName: 'customerName',
      label: '客户姓名',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入客户姓名',
      },
    },
    {
      fieldName: 'customerPhone',
      label: '客户电话',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入客户电话',
      },
    },
    {
      fieldName: 'customerAge',
      label: '客户年龄',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入客户年龄',
      },
    },
    {
      fieldName: 'customerGender',
      label: '客户性别',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入客户性别',
      },
    },
    {
      fieldName: 'specialRequirements',
      label: '特殊要求',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入特殊要求',
      },
    },
    {
      fieldName: 'healthNotes',
      label: '健康备注',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入健康备注',
      },
    },
    {
      fieldName: 'allergies',
      label: '过敏信息JSON',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入过敏信息JSON',
      },
    },
    {
      fieldName: 'preferences',
      label: '偏好设置JSON',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入偏好设置JSON',
      },
    },
    {
      fieldName: 'scope',
      label: '权限范围',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入权限范围',
      },
    },
    {
      fieldName: 'scoperef',
      label: '权限引用',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入权限引用',
      },
    },
    {
      fieldName: 'createTime',
      label: '创建时间',
      component: 'RangePicker',
      componentProps: {
        ...getRangePickerDefaultProps(),
        allowClear: true,
      },
    },
    {
      fieldName: 'customerRelationship',
      label: '与主客户关系',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入与主客户关系',
      },
    },
    {
      fieldName: 'emergencyContact',
      label: '紧急联系人',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入紧急联系人',
      },
    },
    {
      fieldName: 'emergencyPhone',
      label: '紧急联系电话',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入紧急联系电话',
      },
    },
    {
      fieldName: 'medicalHistory',
      label: '病史记录',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入病史记录',
      },
    },
    {
      fieldName: 'currentMedications',
      label: '当前用药情况',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入当前用药情况',
      },
    },
    {
      fieldName: 'dietaryRestrictions',
      label: '饮食限制',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入饮食限制',
      },
    },
    {
      fieldName: 'accessibilityNeeds',
      label: '无障碍需求',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入无障碍需求',
      },
    },
  ];
}

/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<OrderCustomerApi.OrderCustomer>['columns'] {
  return [
    {
      field: 'id',
      title: '主键ID',
      minWidth: 120,

    },
    {
      field: 'orderId',
      title: '关联spa_order表ID',
      minWidth: 120,

    },
    {
      field: 'orderExtensionId',
      title: '关联spa_order_extension表ID',
      minWidth: 120,

    },
    {
      field: 'customerId',
      title: '客户ID',
      minWidth: 120,

    },
    {
      field: 'customerType',
      title: '客户类型',
      minWidth: 120,

    },
    {
      field: 'customerName',
      title: '客户姓名',
      minWidth: 120,

    },
    {
      field: 'customerPhone',
      title: '客户电话',
      minWidth: 120,

    },
    {
      field: 'customerAge',
      title: '客户年龄',
      minWidth: 120,

    },
    {
      field: 'customerGender',
      title: '客户性别',
      minWidth: 120,

    },
    {
      field: 'specialRequirements',
      title: '特殊要求',
      minWidth: 120,

    },
    {
      field: 'healthNotes',
      title: '健康备注',
      minWidth: 120,

    },
    {
      field: 'allergies',
      title: '过敏信息JSON',
      minWidth: 120,

    },
    {
      field: 'preferences',
      title: '偏好设置JSON',
      minWidth: 120,

    },
    {
      field: 'scope',
      title: '权限范围',
      minWidth: 120,

    },
    {
      field: 'scoperef',
      title: '权限引用',
      minWidth: 120,

    },
    {
      field: 'createTime',
      title: '创建时间',
      minWidth: 120,
      formatter: 'formatDateTime',
    },
    {
      field: 'customerRelationship',
      title: '与主客户关系',
      minWidth: 120,

    },
    {
      field: 'emergencyContact',
      title: '紧急联系人',
      minWidth: 120,

    },
    {
      field: 'emergencyPhone',
      title: '紧急联系电话',
      minWidth: 120,

    },
    {
      field: 'medicalHistory',
      title: '病史记录',
      minWidth: 120,

    },
    {
      field: 'currentMedications',
      title: '当前用药情况',
      minWidth: 120,

    },
    {
      field: 'dietaryRestrictions',
      title: '饮食限制',
      minWidth: 120,

    },
    {
      field: 'accessibilityNeeds',
      title: '无障碍需求',
      minWidth: 120,

    },
    {
      title: '操作',
      width: 200,
      fixed: 'right',
      slots: { default: 'actions' },
    },
  ];
}

